<!doctype html>
<html>

<head>
  <!-- css文件 -->
  {include file="public/title" /}
</head>
<body data-type="generalComponents">
  <!-- 头部 -->
  {include file="public/header" /}
  <div class="tpl-page-container tpl-page-header-fixed">
    <!-- 左侧导航 -->
    {include file="public/leftNav" /}
    <div class="tpl-content-wrapper">
      <ol class="am-breadcrumb">
        <li><a href="#" class="am-icon-home">首页</a></li>
        <li><a href="#">栏目管理</a></li>
        <li class="am-active">栏目添加</li>
      </ol>
      <div class="tpl-portlet-components">
        <div class="tpl-block ">
          <div class="am-g tpl-amazeui-form">
            <div class="am-u-sm-12 am-u-md-9">
              <form class="am-form am-form-horizontal" id="form_ajax" onsubmit="return false">
                <div class="am-form-group">
                  <label for="user-mima" class="am-u-sm-3 am-form-label">上级栏目 / column</label>
                  <div class="am-u-sm-9">
                    <select name="pid" data-am-selected="{searchBox: 1}" >
                      <option value="0">-顶级栏目</option>
                      {volist name="value" id="vo"}
                        <option value="{$vo.id}">{if condition="$vo['level'] neq 0"}|{/if}<?php echo str_repeat('-',$vo['level']*3)?>{$vo.catename}</option>
                      {/volist}
                    </select>
                  </div>
                </div>
                <div class="am-form-group">
                  <label for="user-name" class="am-u-sm-3 am-form-label">栏目名称 / Name</label>
                  <div class="am-u-sm-9">
                    <input type="text" name="catename" id="user-name" placeholder="栏目名称 / Name">
                  </div>
                </div>
                <div class="am-form-group">
                  <label for="user-name" class="am-u-sm-3 am-form-label">栏目类型 / Type</label>
                  <div class="am-u-sm-9">
                    <label class="am-radio-inline">
                      <input type="radio" name="type" value="1" name="docInlineRadio" checked/> 文章列表
                    </label>
                    <label class="am-radio-inline">
                      <input type="radio" name="type" value="2"> 单页
                    </label>
                    <label class="am-radio-inline">
                      <input type="radio" name="type" value="3"> 图片列表
                    </label>
                  </div>
                </div>
                <div class="am-form-group">
                  <div class="am-u-sm-9 am-u-sm-push-3">
                    <button type="submit" id="submitFrom" class="am-btn am-btn-primary">添加</button>
                  </div>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- js -->
  {include file="public/foot" /}
  <script type="text/javascript">
    $('#submitFrom').click(function(){
      var formData = $('#form_ajax').serialize();
      $.ajax({
        url:"{:url('cate/add')}",
        type:'POST',
        data:formData,
        success:function(data){
          if(data.code == 1){
            layer.alert(data.msg, {icon: 6});
            $("form")[0].reset();
          }else{
            layer.alert(data.msg, {icon: 5});
          }
        }
      })
    })
  </script>
</body>
</html>